package com.wt.springsamples.ext;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {

        if(beanName.equals("redisTemplate")){
            System.out.println("MyBeanPostProcessor...postProcessBeforeInitialization 方法。。。。");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if(beanName.equals("cat")){
            System.out.println("MyBeanPostProcessor...postProcessAfterInitialization 方法。。。。");
        }
        return bean;
    }
}
